package com.example.xpvideo.annotations;

/**
 * @author : 洪俊新
 * @date : 2021/2/26 16:24
 * @description:  自定义校验注解，用于校验某个字段只能取指定的值
 */

import com.example.xpvideo.validator.ListValueConstraintValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

@Documented
// 指定校验器
@Constraint(validatedBy = {ListValueConstraintValidator.class})
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE,
                ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)

public @interface ListValue {
    String message() default "必须在预选值范围选值";
    Class<?>[] groups() default { };
    Class<? extends Payload>[] payload() default { };
    int[] vals() default { };

}
